Add kick extension and user management services#18
Conversation
PenguinBoi12
left a comment
There was a problem hiding this comment.
In general it's good, there's going to be refactor needed eventually when adding support for Space but for now the services are fine.
There's one big issue though... There's no permission check on the command. This means everyone can run kick anyone through that command. I think in general we want to restrict this extension to admin/moderator only through a check if possible. It's a good time to implement reusable permission check for Ada (perhaps it could even be added as part of the default checks in matrix.py directly eventually).
I'm not sure why you used getattr everywhere, you want to avoid using that as much as possible unless it's absolutely necessary, which is rare.
It would be great to have tests.
| return moderators | ||
|
|
||
|
|
||
| async def is_moderator(ctx: Context) -> bool: |
There was a problem hiding this comment.
This could be fine for now, but I'm sure we can check a user's permission differently.
There was a problem hiding this comment.
| depth: int = 0, | ||
| ) -> None: | ||
| """Collect non-space child room IDs from a Matrix space.""" | ||
| if depth >= 10: |
There was a problem hiding this comment.
I think we can reduce this to 3 since, from what I researched, most clients limit it to 3.
There was a problem hiding this comment.
Also, we might want to log it and ideally find a way to notify admins that we reached the max depth. I have a couple of ideas. Like, raising an error that will notify us that we reached the max depth and that it needs to be ran with a flag enabled to "force it"/means we acknowledged it. (the error would also return the space at the max depth so we can use it later on.
Added the kick extension for managing user removal from rooms and spaces, along with service modules for user management (which can be used for other moderation extension such as ban, mute, etc)